home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
msdemo.zip
/
MSDEMO.DOC
< prev
next >
Wrap
Text File
|
1993-01-04
|
3KB
|
67 lines
INTERRUPT DRIVEN MOUSE DEMO
The files contained in MSDEMO.ARC are a simple text mode
demonstration of using interrupt driven mouse control from within a Turbo
Pascal program. This method, while more complex to implement from a
programming standpoint, is simpler to use once implemented. It is also the
prefered method, because it frees the program from having to poll the mouse
driver for the current status of the mouse.
The code for this program was inspired by an article written by Ray
Duncan for the Power Programming column in PC Magazine. For those of you
who are interested, the article appeared in the May 16, 1989, Vol 8, No. 9
issue.
The demo program was compiled using Turbo Pascal 5.5 but should also
compile under 4.0 or 5.0. The assembler portion was written using IDEAL
mode syntax and assembled using TASM.
MSDEMO.ARC files:
MOUSE.PAS :Source code for the MOUSE unit.
MOUSE.TPU :MOUSE unit compiled with TP 5.5
MOUSE.ASM :Source code for event handler and external routines
of the MOUSE unit.
MOUSE.OBJ :Object code for MOUSE.ASM assembled using TASM.
MSDEMO.PAS :Source code for the demo program.
MSDEMO.EXE :Demonstration program compile using TP 5.5
MSDEMO.DOC :This file.
MSDEMO is a simple program which exhibits some of the capabilities of
using an interrupt driven interface to the mouse. The program first sets up
by calling 'MouseRegister'. This routine checks to see if a mouse drive is
installed on the system. Once that is established it registers the mouse
event handler with the installed mouse driver and initializes the global
variables that make available the mouse status to the rest of the program.
After registering the interrupt handler with the mouse driver the
program displays the mouse cursor and then goes into a loop where it checks
to see if a mouse event has occured. This is signaled by the global
variable 'EventFlag' changing to non-zero. Once this happens the program
then displays the state of the mouse on the screen. Which buttons are
pressed if any, the X and Y location of the mouse cursor, as well as its
screen offset address are all display with each event occurance. This
continues until the right and left mouse buttons are pressed
simultaneously, at which time the program will reset the mouse driver and
exit to DOS.
Like I said simple. Hope you find this of some use.
Bob Landry, Compuserve [73300,1717]